package model.expression.command;

import state.TabState;
import state.TurtleState;


public class Right extends AbstractCommandExpression{

	public Right(TabState ts) {
		super(ts);
	}

	@Override
	public int evaluate() {
		//Needs to modify state by the value of its children;
		int step = this.children.get(0).evaluate();
		
		//for each active turtle, evaluate
		for (Integer i : tabSt.getActiveTurtle()){
			TurtleState st= tabSt.turtlesMap.get(i);
			st.setOrientation(st.getOrientation() + step);
			st.notifyObservers();
		}
		return step;
	}

	@Override
	protected int getExpNumChildren() {
		return 1;
	}

}

